from django.conf.urls.defaults import *
from django.contrib.auth import views as auth_views
from django.views.generic.simple import direct_to_template
from django.conf import settings


# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('timesheet.views',
    #('^account/profile/$', table),
    # Example:
    # (r'^Timesheet/', include('Timesheet.foo.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
     (r'^admin/', include(admin.sites.site.urls)),
     url(r'^login/$',
         auth_views.login,
         {'template_name': 'authorization/login.html'},
         name='auth_login'),
     url(r'^logout/$', 'logout', name='auth_logout'),
     url(r'^password/reset/$',
         auth_views.password_reset,
         name='auth_password_reset'),
     url(r'^password/reset/done/$',
         auth_views.password_reset_done,
         name='auth_password_reset_done'),
     url(r'^password/reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
         auth_views.password_reset_confirm,
         name='auth_password_reset_confirm'),
     url(r'^login/user/$', 'user_redirect', name='user'),
     url(r'^login/user/(?P<day>\d{4}-\d{2}-\d{2})/$', 'user', name='user_day'),
     url(r'^login/user/user_complete/$', 'redirect_to_complete', name='user_complete'),
     url(r'^login/user/user_complete/(?P<number_week>\d{1,6})/$', 'user_week_complete',
                                                             name='user_week_complete'),
     url(r'^invalid/$', direct_to_template,
      {'template': 'authorization/auth_invalid.html'}, name='invalid'),
)


urlpatterns += patterns('',
     url(r'^login/user/financier/$', 'financier.views.financier', name='financier'),
)

urlpatterns += patterns('',
     (r'^login/user/\d{4}-\d{2}-\d{2}/media/js/(?P<path>.*)$', 
       'django.views.static.serve', {'document_root': settings.MEDIA_ROOT + '/js/'}),
     (r'^login/user/\d{4}-\d{2}-\d{2}/media/css/(?P<path>.*)$', 
       'django.views.static.serve', {'document_root': settings.MEDIA_ROOT + '/css/'}),
     (r'^login/user/financier/media/js/(?P<path>.*)$', 
       'django.views.static.serve', {'document_root': settings.MEDIA_ROOT + '/js/'}),
     (r'^login/user/financier/media/css/(?P<path>.*)$', 
       'django.views.static.serve', {'document_root': settings.MEDIA_ROOT + '/css/'}),
     (r'^login/user/media/js/(?P<path>.*)$', 
       'django.views.static.serve', {'document_root': settings.MEDIA_ROOT + '/js/'}),
     (r'^login/user/media/css/(?P<path>.*)$', 
       'django.views.static.serve', {'document_root': settings.MEDIA_ROOT + '/css/'}),
     (r'^login/media/css/(?P<path>.*)$', 
       'django.views.static.serve', {'document_root': settings.MEDIA_ROOT + '/css/'}),
     (r'^login/user/user_complete/\d{1,6}/media/css/(?P<path>.*)$', 
       'django.views.static.serve', {'document_root': settings.MEDIA_ROOT + '/css/'}),
     (r'^login/user/user_complete/media/js/(?P<path>.*)$', 
       'django.views.static.serve', {'document_root': settings.MEDIA_ROOT + '/js/'}),
)

urlpatterns += patterns('',
    url(r'^manager/$', 'manager.views.manager', name='manager'),
    (r'^manager/css/(?P<path>.*)$', 
		        'django.views.static.serve',
                {'document_root': settings.MEDIA_ROOT + '/manager/base_manager/css'}),
	(r'^manager/javascript/(?P<path>.*)$', 
		        'django.views.static.serve',
                {'document_root': settings.MEDIA_ROOT + '/manager/base_manager/javascript'}),
    url(r'^manager/crud/$', 'manager.views.manager_crud', name='manager_crud'),
    (r'^manager/crud/css/(?P<path>.*)$', 
		        'django.views.static.serve',
                {'document_root': settings.MEDIA_ROOT + '/manager/crud_manager/css'}),
	(r'^manager/crud/javascript/(?P<path>.*)$', 
		        'django.views.static.serve',
                {'document_root': settings.MEDIA_ROOT + '/manager/crud_manager/javascript'}),
    (r'^manager/invalid/$', direct_to_template,
                {'template': 'registration/auth_invalid.html'}),
    
)
